package cn.gyn.gynrpc.core.transport;

import cn.gyn.gynrpc.core.annotation.GynProvider;
import cn.gyn.gynrpc.core.api.RpcRequest;
import cn.gyn.gynrpc.core.api.RpcResponse;
import cn.gyn.gynrpc.core.consumer.GynInvocationHandler;
import cn.gyn.gynrpc.core.provider.ProviderInvoker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用来接入所有的请求，一般都命名为Transport
 */
@RestController
public class SpringBootTransport {
    @Autowired
    ProviderInvoker providerInvoker;

    @RequestMapping("/gynrpc")
    public RpcResponse<Object> invoke(@RequestBody RpcRequest request) {
        return providerInvoker.Invoke(request);
    }

}